package com.ytjj.qmyx.admin.controller;

import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.admin.model.request.EvaluationRequest;
import com.ytjj.qmyx.admin.service.EvaluationProductSpecService;
import com.ytjj.qmyx.mall.model.EvaluationProductSpec;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 *
 * @Version: 1.0
 */
@RestController
@RequestMapping("/evaluationSpec")
public class EvaluationSpecController {

    @Autowired
    private EvaluationProductSpecService evaluationProductSpecService;

    @PostMapping("/list")
    public CommonResult getSpecList(@RequestBody EvaluationRequest evaluationRequest) {
        return CommonResult.success(evaluationProductSpecService.getSpecList(evaluationRequest));
    }

    @PostMapping("/updateSpecInfo")
    public CommonResult updateSpecInfo(@RequestBody EvaluationProductSpec evaluationProductSpec) {
        Integer count = evaluationProductSpecService.updateSpecInfo(evaluationProductSpec);
        if(count > 0) {
            return CommonResult.success(count);
        } else {
            return CommonResult.failed();
        }
    }

}
